package com.aaa.behind.dao;

import com.aaa.entity.BBusinessInfo;
import com.aaa.entity.BusinessSort;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 商家信息表 Mapper 接口
 * </p>
 *
 * @author whj
 * @since 2023-01-05
 */
public interface BBusinessInfoMapper extends BaseMapper<BBusinessInfo> {

    @Select("SELECT g.sortname name, COUNT(b.sortid) value from b_business_info b,g_sort g where b.sortid=g.id GROUP BY b.sortid")
    List<BusinessSort> findSortid();

    @Select("select id from b_business_info where sname = #{sname}")
    String selectId(String sname);

    IPage selectAll(IPage page, @Param("businessInfo") BBusinessInfo businessInfo);


    @Select("select id from g_sort where sortname = #{sortid}")
    String selectSortId(String sortid);
}
